import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:写一个递归方法，输入一个非负整数，返回组成它的数字之和
 * User: zjc
 * Date: 2022-05-08
 * Time: 23:06
 */
public class Project {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int sum = fac(n);
        System.out.println(sum);
    }
    public static int fac(int n){
        int sum = 0;
        if(n<10){
            sum = n;
        }else{
            sum = n%10 + fac(n/10);
        }
        return sum;
    }
}
